#include<func.h>
//chat1先读pipe1再写pipe2
int main(int argc,char *argv[])
{
    ARGS_CHECK(argc,3)
    int fdr,fdw;
    fdr=open(argv[1],O_RDONLY);
    fdw=open(argv[2],O_WRONLY);
    while(1)
    {
    //读程序
        char buf[128]={0};
        read(fdr,buf,sizeof(buf));
        printf("get=%s\n",buf);
    //写程序
        memset(buf,0,sizeof(buf));
        read(STDIN_FILENO,buf,sizeof(buf));
        printf("buf=%s\n",buf);
        write(fdw,buf,strlen(buf)-1);   
    }
    return 0;
}